import http from './index'

export const getCode = (params) => {
    return http({
        url: `/api/mobile_verify_code/send?mobile=${params.mobile}`,
        method: 'POST',
        data: params
    })
}

export const refreshToken = (params) => {
    return http({
        url: `/api/auth/refresh_token?refreshToken=${params.refreshToken}`,
        method: 'POST',
        data: params
    })
}
export const loginByCode = (params) => {
    return http({
        url: `/api/auth/login_by_verify_code?mobile=${params.mobile}&code=${params.code}`,
        method: 'POST',
        data: params
    })
}
export const loginByPwd = (params) => {
    return http({
        url: `/api/auth/login_by_mobile_pwd?mobile=${params.mobile}&password=${params.password}`,
        method: 'POST',
        data: params
    })
}
export const register = (params) => {
    return http({
        url: `/api/auth/register`,
        method: 'POST',
        data: params
    })
}
export const getUserInfo = (params) => {
    return http({
        url: `/api/user/profile/get`,
        method: 'GET',
        params
    })
}

export const logoff = (params) => {
    return http({
        url: `/api/user/profile/delete_account?verifyCode=${params.verifyCode}`,
        method: 'POST',
        params
    })
}

// 实名认证
export const saveAuth = (data) => {
    return http({
        url: `/api/user/auth/save_auth`,
        method: 'POST',
        data
    })
}
// 实名认证链接
export const getSign = (data) => {
    return http({
        url: `/api/user/auth/sign_url`,
        method: 'GET',
        data
    })
}
// 获取实名认证
export const getAuth = (params) => {
    return http({
        url: `/api/user/auth/info`,
        method: 'GET',
        params
    })
}